package net.shopxx.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.constraints.Length;

/**
 * Entity - 刷单明细
 * 
 * @author frankie
 * @version 3.0
 */

@Entity
@Table(name = "bmw_shua_item")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "bmw_shua_item_sequence")
public class ShuaItem extends BaseEntity{

	private static final long serialVersionUID = -3150211113256914408L;
	
	/** 对方小号 **/
	private String name;
	
	/** 关键字 **/
	private String keyword;
	
	/** 操作金额 **/
	private Float sum;

	/** 店铺Id **/
	private Integer storeId;
	
	/** 刷单平台 **/
	private String platform;
	
	/** 对方QQ(刷我) **/
	private String qq;
	
	/** 平台昵称(刷我) **/
	private String fromNick;
	
	/** 平台昵称(刷他) **/
	private String toNick;
	
	/** 对方大号 **/
	private String target;
	
	/** 我方小号 **/
	private String xiaohao;
	
	/** 刷单状态 */
	private Integer status;
	
	/** 操作者 **/
	private String operator;
	
	/** 佣金 **/
	private Float commission;
	
	/** 备忘 **/
	private String memo;
	
	/** 是否需要关注 **/
	private boolean attention;
	

	/**
	 * 获取对方小号
	 * 
	 * @return 对方小号
	 */
	@Length(max = 20)
	@Column(nullable = false, length = 50)
	public String getName() {
		if(StringUtils.isNotBlank(name)){
			return name.replaceAll("[ |　]", " ").trim();
		}else{
			return name;
		}
	}

	/**
	 * 设置对方小号
	 * @param from
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 获取关键字 
	 * 
	 * @return 关键字
	 */
	@Column(nullable = false, length = 100)
	public String getKeyword() {
		return keyword;
	}

	/**
	 * 设置关键字
	 * 
	 * @param keyword
	 */
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	/**
	 * 获取总金额
	 * 
	 * @return 总金额
	 */
	@Column(nullable = false)
	public Float getSum() {
		return sum;
	}

	/**
	 * 设置总金额
	 * 
	 * @param sum
	 */
	public void setSum(Float sum) {
		this.sum = sum;
	}

	/**
	 * 获取店铺Id
	 * 
	 * @return 店铺Id
	 */
	@Column(nullable = false)
	public Integer getStoreId() {
		return storeId;
	}

	/**
	 * 设置店铺Id
	 * 
	 * @param storeId
	 */
	public void setStoreId(Integer storeId) {
		this.storeId = storeId;
	}

	/**
	 * 获取平台名称
	 * 
	 * @return 平台名称
	 */
	@Length(max = 20)
	@Column(nullable = false, length = 50)
	public String getPlatform() {
		return platform;
	}

	/**
	 * 设置平台名称
	 * 
	 * @param platform
	 */
	public void setPlatform(String platform) {
		this.platform = platform;
	}

	/**
	 * 获取对方qq(刷我)
	 * 
	 * @return 对方qq(刷我)
	 */
	@Length(max = 20)
	@Column(nullable = false, length = 50)
	public String getQq() {
		return qq;
	}

	/**
	 * 设置对方qq(刷我)
	 * 
	 * @param qq
	 */
	public void setQq(String qq) {
		this.qq = qq;
	}

	/**
	 * 获取平台昵称(刷我)
	 * 
	 * @return 平台昵称(刷我)
	 */
	@Length(max = 20)
	@Column(nullable = false, length = 50)
	public String getFromNick() {
		return fromNick;
	}

	/**
	 * 设置平台昵称(刷我)
	 * 
	 * @param fromNick
	 */
	public void setFromNick(String fromNick) {
		this.fromNick = fromNick;
	}

	/**
	 * 获取平台昵称(刷他)
	 * 
	 * @return 平台昵称(刷他)
	 */
	@Length(max = 20)
	public String getToNick() {
		return toNick;
	}

	/**
	 * 设置平台昵称(刷他)
	 * 
	 * @param toNick
	 */
	public void setToNick(String toNick) {
		this.toNick = toNick;
	}

	/**
	 * 获取对方大号
	 * 
	 * @return 对方大号
	 */
	@Length(max = 20)
	public String getTarget() {
		return target;
	}

	/**
	 * 设置对方大号
	 * 
	 * @param to
	 */
	public void setTarget(String target) {
		this.target = target;
	}

	/**
	 * 获取我方小号
	 * 
	 * @return 我方小号
	 */
	@Length(max = 20)
	public String getXiaohao() {
		return xiaohao;
	}

	/**
	 * 设置我方小号
	 * 
	 * @param xiaohao
	 */
	public void setXiaohao(String xiaohao) {
		this.xiaohao = xiaohao;
	}
	
	/**
	 * 获取刷单状态
	 * 
	 * @return 刷单状态
	 */
	@Column(nullable = false)
	public Integer getStatus() {
		return status;
	}
	
	/**
	 * 设置刷单状态
	 * 
	 * @param status
	 */
	public void setStatus(Integer status){
		this.status = status;
	}
	
	/**
	 * 获取操作员
	 * 
	 * @return 操作员
	 */
	@Column(updatable = false, length = 20)
	public String getOperator() {
		return operator;
	}

	/**
	 * 设置操作员
	 * 
	 * @param operator
	 */
	public void setOperator(String operator) {
		this.operator = operator;
	}
	
	/**
	 * 获取佣金
	 * 
	 * @return 佣金
	 */
	@Column(nullable = false)
	public Float getCommission() {
		if(commission == null){
			return 0f;
		}else{
			return commission;
		}
	}

	/**
	 * 设置佣金
	 * 
	 * @param commission
	 */
	public void setCommission(Float commission) {
		this.commission = commission;
	}

	/**
	 * 获取备忘
	 * 
	 * @return
	 */
	public String getMemo() {
		return memo;
	}

	/**
	 * 设置备忘
	 * 
	 * @param memo
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 * 获取关注单
	 * 
	 * @return
	 */
	@Column(nullable = false)
	public Boolean getAttention() {
		return attention;
	}

	/**
	 * 设置关注单
	 * 
	 * @param attention
	 */
	public void setAttention(Boolean attention) {
		this.attention = attention;
	}

}
